<?php $this->pageHeader('Kurs og kompetanse'); ?>

<?php echo $this->flashMessage()->renderMessages(); ?>

<h2>Kurs</h2>

<table id="courses">
  <thead>
  <tr>
    <th>Navn</th>
    <th>Gyldighetstid (mnd)</th>
    <th>Antall medlemmer</th>
  </tr>
  </thead>
  <tbody>
<?php
foreach ($this->courses as $course) :
  //$backgroundColor = is_null($course->archived_date) ? '' : ' style="background-color: #F0F0F0"';
  $backgroundColor = "";
?>
  <tr<?php echo $backgroundColor; ?>>
    <td><a href="<?php echo $this->url(array('module' => 'admin', 'controller' => 'course', 'action' => 'edit', 'id' => $course->id), null, true); ?>"><?php echo $this->escape($course->name); ?></a>
    <?php if (!is_null($course->archived_date)) { echo " (Arkivert)"; } ?>
    </td>
    <td><?php echo is_null($course->months_valid) ? '&infin;' : $course->months_valid; ?></td>
    <td><?php echo $course->num_members; ?></td>
  </tr>
<?php endforeach; ?>
  </tbody>
</table>

<h2>Kompetanser</h2>

<table id="competences">
  <thead>
  <tr>
    <th>Navn</th>
    <th>Gyldighetstid (mnd)</th>
    <th>Antall medlemmer</td>
  </thead>
  <tbody>
<?php
foreach ($this->competences as $competence) :
  /*$backgroundColor = is_null($competence->archived_date) ? '' : ' style="background-color: #F0F0F0"';*/
  $backgroundColor = "";
?>
  <tr<?php echo $backgroundColor; ?>>
    <td><a href="<?php echo $this->url(array('module' => 'admin', 'controller' => 'course', 'action' => 'edit', 'id' => $competence->id), null, true); ?>"><?php echo $this->escape($competence->name); ?></a>
    <?php if (!is_null($competence->archived_date)) { echo " (Arkivert)"; } ?>
    </td>
    <td><?php echo is_null($competence->months_valid) ? '&infin;' : $competence->months_valid; ?></td>
    <td><?php echo $competence->num_members; ?></td>
  </tr>
<?php endforeach; ?>
  </tbody>
</table>
